package com.bh.ly.oa.util;

import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class GetJSonData {
	
	/**
	 * 订单管理 
	 */
	public static String getOrderListJsonData(Map mp){
		JSONObject ob=new JSONObject();
		String orderno=((String) mp.get("order_number"))!=null?((String) mp.get("order_number")):"";
		String startdate=((String) mp.get("startdate"))!=null?((String) mp.get("startdate")):"";
		String enddate=((String) mp.get("enddate"))!=null?((String) mp.get("enddate")):"";
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		
//		try {
//			ob.put("conditionData","{\"orderno\":\""+orderno+"\",\"orderno__tablename\":\"bil_order\",\"orderno__datatype\":\"char\",\"orderno__match\":\"1\",\"orderno__datavalue_more\":\"\",\"recorddate\":[\""+startdate+"\",\""+enddate+"\"],\"recorddate__tablename\":[\"bil_order\",\"bil_order\"],\"recorddate__datatype\":[\"date\",\"date\"],\"recorddate__match\":[\"5\",\"6\"],\"recorddate__datavalue_more\":[\"\",\"\"]}");
//			ob.put("specialCondition", null);
//			ob.put("currentPage",mp.get("currentPage")!=null?mp.get("currentPage"):1);
//		} catch (JSONException e) {			
//			e.printStackTrace();
//		}
		String requestdata="{\"conditionData\":{\"orderno\":\""+orderno+"\",\"orderno__tablename\":\"bil_order\",\"orderno__datatype\":\"char\",\"orderno__match\":\"1\",\"orderno__datavalue_more\":\"\",\"recorddate\":[\""+startdate+"\",\""+enddate+"\"],\"recorddate__tablename\":[\"bil_order\",\"bil_order\"],\"recorddate__datatype\":[\"date\",\"date\"],\"recorddate__match\":[\"5\",\"6\"],\"recorddate__datavalue_more\":[\"\",\"\"]},\"specialCondition\":null,\"currentPage\":"+currentPage+"}";
		Log.v("==========新订单=======", requestdata);
		return requestdata;
	}
	
	/**
	 * 退单管理
	 * @param mp
	 * @return
	 */
	public static String getRelbackOrderListJsonDatat(Map mp){
		String orderno=((String) mp.get("order_number"))!=null?((String) mp.get("order_number")):"";
		String startdate=((String) mp.get("startdate"))!=null?((String) mp.get("startdate")):"";
		String enddate=((String) mp.get("enddate"))!=null?((String) mp.get("enddate")):"";
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		
		String requestdata="{\"conditionData\":{\"dealflag\":\"1\",\"dealflag__tablename\":\"bil_returnfac\",\"dealflag__datatype\":\"number\",\"dealflag__match\":\"1\",\"dealflag__datavalue_more\":\"\",\"billno\":\""+orderno+"\",\"billno__tablename\":\"bil_returnfac\",\"billno__datatype\":\"char\",\"billno__match\":\"1\",\"billno__datavalue_more\":\"\",\"returndate\":[\""+startdate+"\",\""+enddate+"\"],\"returndate__tablename\":[\"bil_returnfac\",\"bil_returnfac\"],\"returndate__datatype\":[\"date\",\"date\"],\"returndate__match\":[\"5\",\"6\"],\"returndate__datavalue_more\":[\"\",\"\"]},\"specialCondition\":null,\"currentPage\":"+ currentPage +"}";
		Log.v("==========退单=======", requestdata);
		return requestdata;
	}
	
	public static String getBackOrderNotice(Map mp){
        JSONObject ob=new JSONObject();
        String orderno=((String) mp.get("order_number"))!=null?((String) mp.get("order_number")):"";
        String startdate=((String) mp.get("startdate"))!=null?((String) mp.get("startdate")):"";
        String enddate=((String) mp.get("enddate"))!=null?((String) mp.get("enddate")):"";
        Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		
        String requestdata="{\"conditionData\":{\"dealflag\":\"1\",\"dealflag__tablename\":\"bil_returnfac\",\"dealflag__datatype\":\"number\",\"dealflag__match\":\"1\",\"dealflag__datavalue_more\":\"\",\"billno\":\""+orderno+"\",\"billno__tablename\":\"bil_returnfac\",\"billno__datatype\":\"char\",\"billno__match\":\"1\",\"billno__datavalue_more\":\"\",\"returndate\":[\""+startdate+"\",\""+enddate+"\"],\"returndate__tablename\":[\"bil_returnfac\",\"bil_returnfac\"],\"returndate__datatype\":[\"date\",\"date\"],\"returndate__match\":[\"5\",\"6\"],\"returndate__datavalue_more\":[\"\",\"\"]},\"specialCondition\":null,\"currentPage\":" + currentPage + "}";
        Log.v("==========退单=======", requestdata);
        return requestdata;
    }
	
	public static String getOrderDetailJsonData(Map mp){
		String orderno=((String) mp.get("order_number"))!=null?((String) mp.get("order_number")):"";
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		return "{\"conditionData\":{\"orderno\":\""+orderno+"\",\"orderno__tablename\":\"bil_order\",\"orderno__datatype\":\"char\",\"orderno__match\":\"1\",\"orderno__datavalue_more\":\"\"},\"currentPage\":" + currentPage + "}";

	}

	public static String getGoodSaleJsonData(Map mp) { 
		String startdate=mp.get("startDate")!=null?(String)mp.get("startDate"):DateUtil.getMondayOFWeek();
		String enddate=mp.get("endDate")!=null?(String)mp.get("endDate"):DateUtil.getCurrentWeekday();
		String deptcode=mp.get("deptcode")!=null?(String)mp.get("deptcode"):"";
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		String param="{\"conditionData\":{\"deptcode\":\""+deptcode+"\",\"deptcode__tablename\":\"stockshop\",\"deptcode__datatype\":\"char\",\"deptcode__match\":\"1\",\"deptcode__datavalue_more\":\"\",\"recorddate\":[\""+startdate+"\",\""+enddate+"\"],\"recorddate__tablename\":[\"rep_goods_sale\",\"rep_goods_sale\"],\"recorddate__datatype\":[\"date\",\"date\"],\"recorddate__match\":[\"5\",\"6\"],\"recorddate__datavalue_more\":[\"\",\"\"]},\"currentPage\":" + currentPage + "}";
		return param;
	}
	
	public static String getSuppliersaleJsonData(Map mp) { 
		String startdate=mp.get("startDate")!=null?(String)mp.get("startDate"):DateUtil.getMondayOFWeek();
		String enddate=mp.get("endDate")!=null?(String)mp.get("endDate"):DateUtil.getCurrentWeekday();
		String stripecode=mp.get("stripecode")!=null?(String)mp.get("stripecode"):"";
		String gdsname=mp.get("gdsname")!=null?(String)mp.get("gdsname"):"";
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		
		String param="{\"conditionData\":{\"stripecode\":\""+stripecode+"\",\"stripecode__tablename\":\"inf_goods\",\"stripecode__datatype\":\"char\",\"stripecode__match\":\"2\",\"stripecode__datavalue_more\":\"\",\"gdsname\":\""+gdsname+"\",\"gdsname__tablename\":\"inf_goods\",\"gdsname__datatype\":\"char\",\"gdsname__match\":\"3\",\"gdsname__datavalue_more\":\"\",\"recorddate\":[\""+startdate+"\",\""+enddate+"\"],\"recorddate__tablename\":[\"rep_goods_sale\",\"rep_goods_sale\"],\"recorddate__datatype\":[\"date\",\"date\"],\"recorddate__match\":[\"5\",\"6\"],\"recorddate__datavalue_more\":[\"\",\"\"]},\"currentPage\":" + currentPage + "}";
		return param;
	}
	public static String getAnnouncementJsonData(Map mp) {
		String startdate=mp.get("startDate")!=null?(String)mp.get("startDate"):DateUtil.getMondayOFWeek();
		String enddate=mp.get("endDate")!=null?(String)mp.get("endDate"):DateUtil.getCurrentWeekday();
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		
		return "{\"conditionData\":{\"recorddate\":[\""+startdate+"\",\""+enddate+"\"],\"recorddate__tablename\":[\"scm_announcement\",\"scm_announcement\"],\"recorddate__datatype\":[\"date\",\"date\"],\"recorddate__match\":[\"5\",\"6\"],\"recorddate__datavalue_more\":[\"\",\"\"]},\"currentPage\":" + currentPage + "}";
	}

	public static String getlicenseJsonData(Map mp) {
		Integer currentPage=((Integer) mp.get("currentPage"))!=null?((Integer) mp.get("currentPage")): 1 ;
		return "{\"conditionData\":{\"suppliercode\":\"\",\"suppliercode__tablename\":\"inf_supplier\"," + 
	        "\"suppliercode__datatype\":\"char\"," + 
			"\"suppliercode__match\":\"1\"," +
			"\"suppliercode__datavalue_more\":\"\"," +
	        "\"certificate_type\":\"\"," +
	        "\"certificate_type__tablename\":\"bil_supplier_certificate\"," +
	        "\"certificate_type__datatype\":\"number\"," +
	        "\"certificate_type__match\":\"1\"," +
	        "\"certificate_type__datavalue_more\":\"\"," +
	        "\"enddate\":[\"\",\"\"]," +
	        "\"enddate__tablename\":[\"bil_supplier_certificate\",\"bil_supplier_certificate\"]," +
	        "\"enddate__datatype\":[\"date\",\"date\"]," +
	        "\"enddate__match\":[\"5\",\"6\"]," +
	        "\"enddate__datavalue_more\":[\"\",\"\"]," +
	        "\"recorddate\":[\"\",\"\"]," +
	        "\"recorddate__tablename\":[\"bil_supplier_certificate\",\"bil_supplier_certificate\"]," +
	        "\"recorddate__datatype\":[\"date\",\"date\"]," +
	        "\"recorddate__match\":[\"5\",\"6\"]," +
	        "\"recorddate__datavalue_more\":[\"\",\"\"]}," +
	        "\"specialCondition\":null,\"currentPage\":" + currentPage + "}";
	}
}
